package com.ayou.healthmanagement.controller;

import com.ayou.healthmanagement.pojo.HealthRecord;
import com.ayou.healthmanagement.utils.Result;
import com.ayou.healthmanagement.service.HealthRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("record")
public class HealthRecordController {

    @Autowired
    private HealthRecordService healthRecordService;

    @GetMapping("/getHealthRecords")
    public Result getHealthRecords(String beginTime, String endTime, Integer pageNum, Integer pageSize){
//        System.out.println(beginTime+"0=0=0="+endTime);
//        return Result.success();
        return healthRecordService.getHealthRecords(beginTime,endTime,pageNum,pageSize);
    }

    @GetMapping("/delHealthRecord")
    public Result delHealthRecord(Integer id){
        return healthRecordService.delHealthRecord(id);
    }

    @PostMapping("/insertHealthRecord")
    public Result insertHealthRecord(@RequestBody HealthRecord healthMedicine){
        return healthRecordService.insertHealthRecord(healthMedicine);
    }
}
